﻿ <%--
 *  File:   VisitPlanDayTempletSummary.jsp
 *  Desc:	
 *
 *  Date		         Author		      Changes
 *  2009-11-4 17:36:21	  Kent		  Created
 *
 *  Copyright (C) 2000 - 2009 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%
  //init param
  String strTableName = "v_visitplancontactsummary";
  String strModuleName = "SFE";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.customtag.element.*"%>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>
 <%@ include file="/inc/PreparePageBack.inc" %>
 <%@ include file="/inc/FrmDefault.inc" %>
<%--added by fekindai 2009/12/09 start--%>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<%-- end --%>

<html>
<head>
<title>VisitPlanDayTempletSummary</title>
<%
if("Y".equals(request.getParameter("isconfirm"))){%>

<script>
	
	opener.refreshWindow();
	window.close();
</script>
<%return;
}%>	


<PageFlow:CheckPageFlow pageName="p_visitadd2plandayummary"/>
<%
int nYear=((Integer)pageContext.getAttribute("year")).intValue();
int nMonth=((Integer)pageContext.getAttribute("monthofyear")).intValue();
int nWeek=((Integer)pageContext.getAttribute("weekofmonth")).intValue();
int nDay=((Integer)pageContext.getAttribute("dayofweek")).intValue();
Calendar cal=null;
if(nYear>0 && nMonth>0 && nWeek>0)
{cal=Calendar.getInstance();
cal.clear();
cal.setFirstDayOfWeek(Calendar.MONDAY);
cal.set(Calendar.YEAR, nYear);
cal.set(Calendar.MONTH, nMonth-1);
cal.set(Calendar.WEEK_OF_MONTH, nWeek);
cal.add(Calendar.DATE,nDay-1);
}
java.text.SimpleDateFormat sdf=new java.text.SimpleDateFormat("yyyy-MM-dd");
String strVisitDate=sdf.format(cal.getTime());
%>
<%@ include file="/inc/CatchError.inc" %>
<%@ include file="/inc/SumDiv.inc" %>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>
<script language="JavaScript">
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "VisitPlanAdd2DayTemplet.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function clickRow(obj,idx)
{
  var cform = document.cform;
  cform.radiorow[idx].checked=true;
  cform.visitplandaytempletid.value = eval('obj.all.visitplandaytempletid'+idx).value;
}

function page_info()
{
	var cform = document.cform;
    var id = cform.visitplandaytempletid.value;
	var orgid = cform.orgid.value;
	var contactid = cform.contactid.value;
	var strUrl="VisitAdd2DayTempletDetail.jsp?displayflag=view&&contactid="+contactid+"&orgid="+orgid+"&visitplandaytempletid="+id+"&<%= OvalTools.randomURL() %>";
	var status="height=500, width=800,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";	
    if(popwindow!=null)
        popwindow.close();
     popwindow=window.open(strUrl, "viewwindow", status);
}

function page_cancel()
{
	window.close();
}

function page_confirm()
{
	var cform = document.cform;
	var id = cform.visitplandaytempletid.value;
	if(isEmpty(id) || id == -1) return;
	cform.actionname.value="add";
	cform.target="_self";
	isRunning = true;
    cform.submit();
}	

</script>
</head>

<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_visitadd2plandayummary">
    <input type="hidden" name="actionname">
    <custom:hidden property="contactid"/>
    <custom:hidden property="orgid"/>
    <custom:hidden property="year"/>
    <custom:hidden property="monthofyear"/>
    <custom:hidden property="weekofmonth"/>
    <custom:hidden property="dayofweek"/>
    <custom:hidden property="ishistory"/>	
    <custom:hidden property="visitplanid" />
    <custom:hidden property="weekstart"/>
    <custom:hidden property="weekend" />	
    <custom:hidden property="weekstartweekofmonth" />	
    <custom:hidden property="activitytype" />	
    <custom:hidden property="plantype" />
    <custom:hidden property="detailsstatus" />
    <input type="hidden" name="planstarttime" value="<%=strVisitDate%>"/>
	<input type="hidden" name="planendtime" value="<%=strVisitDate%>"/>
	<input type="hidden" name="planvisitdate" value="<%=strVisitDate%>"/>



<table width="100%" cellspacing="0" border="0" cellpadding="0">
      <tr>
<%--  search criteria  --%>
      </tr>
      <tr>
        <td width="200px">
          <table width="100%" border="0" cellspacing="0">
            <%@ include file="/inc/SummarySearch.inc" %>
          </table>
        </td>
        <td></td>
      </tr>
      <tr>
        <td>
          <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">

<%
    ArrayList titleTdArray = new ArrayList();
    titleTdArray.add(new TD("22","&nbsp;"));
    titleTdArray.add(new TitleTD("100","L_TempletCode","templetcode","SFE") );
    titleTdArray.add(new TitleTD("120","L_TempletName","templetname","SFE"));
    titleTdArray.add(new TitleTD("100","L_VisitProcess","processname","SFE"));

 %>
    <custom:titletr styleClass="deepblue-left" tdArray="<%=titleTdArray%>" />


 <%
     ArrayList detailTdArray = new ArrayList();
     detailTdArray.add(new RadioTD());
     detailTdArray.add(new WriteTD("templetcode").addHyperlink("javascript:page_info();",null));
     
     detailTdArray.add(new WriteTD("templetname"));
     detailTdArray.add(new WriteTD("processname"));
     ArrayList hiddenArray = new ArrayList();
     hiddenArray.add(new HiddenInput("visitplandaytempletid",true));
    // hiddenArray.add(new HiddenInput("status",true));
 %>
    <custom:iteratetr tdArray="<%=detailTdArray%>" hiddenArray="<%=hiddenArray%>"  dataSource="templetsummary"/>
            <%@ include file="/inc/SummaryAction.inc" %>

          </table>
                    <table width="100%" cellspacing="0" cellpadding="0">
            <tr><td class="summary_top"></td></tr>
            <tr>
              <td class="td_center">
                <a onclick="page_confirm();"><custom:button type="1" label="L_Confirm" imgsrc="new.gif" border="0" style="width:60"/></a>
                <a onclick="page_cancel();"><custom:button type="1" label="L_Cancel" imgsrc="Modify.gif" border="0" style="width:60"/></a>
            
              </td>
            </tr>
          </table>
          
          
          
        </td>
      </tr>
    </table>
</form>
</body>

</html>
